package com.taotao.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.EasyUiTreeNode;
import com.taotao.common.pojo.TaotaoResult;
import com.taotao.service.ContentCatService;

@Controller
@RequestMapping("/content/category")
public class ContentCatController {
	@Autowired
	private ContentCatService contentCatService;

	@RequestMapping("/list")
	public @ResponseBody List<EasyUiTreeNode> getContentCatList(@RequestParam(value = "id", defaultValue = "0") Long parentId) {
		return contentCatService.getContentCatList(parentId);
	}

	@RequestMapping("/create")
	public @ResponseBody TaotaoResult createContentCategory(Long parentId, String name) {
		return contentCatService.createContentCategory(parentId, name);
	}

	@RequestMapping("/delete")
	public @ResponseBody TaotaoResult deleteContentCategory(Long parentId, Long id) {
		return contentCatService.deleteContentCategory(parentId, id);
	}

	@RequestMapping("/update")
	public @ResponseBody TaotaoResult updateContentCategory(Long id, String name) {
		return contentCatService.updateContentCategory(id, name);
	}
}
